package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.border.BevelBorder;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.border.EtchedBorder;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ReportSelection extends JFrame {

	String fireplaceQuery = "Select Fireplace_ID, Fireplace_Name, Description, Finish, Style, Item_price, Stock_quantity, Supplier_name from fireplace, supplier where fireplace.supplier_id = supplier.supplier_id";
	String supplierQuery = "Select * from supplier";
	String fireplaceTitle = "Fireplace Report";
	String supplierTitle = "Supplier Report";
	JFrame thisFrame = this;
	private JPanel contentPane;

	/**
	 * Create the frame.
	 */
	public ReportSelection() {
		setTitle("Select Report");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		setResizable(false);

		JPanel panel = new JPanel();
		panel.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null,
				null));

		JPanel panel_1 = new JPanel();
		panel_1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));

		JButton btnNewButton_2 = new JButton("Exit");
		btnNewButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {

				thisFrame.dispose();
			}
		});
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane
				.setHorizontalGroup(gl_contentPane
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_contentPane
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												gl_contentPane
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																Alignment.TRAILING,
																gl_contentPane
																		.createSequentialGroup()
																		.addComponent(
																				btnNewButton_2,
																				GroupLayout.PREFERRED_SIZE,
																				82,
																				GroupLayout.PREFERRED_SIZE)
																		.addGap(21))
														.addGroup(
																Alignment.TRAILING,
																gl_contentPane
																		.createSequentialGroup()
																		.addGroup(
																				gl_contentPane
																						.createParallelGroup(
																								Alignment.TRAILING)
																						.addComponent(
																								panel,
																								Alignment.LEADING,
																								GroupLayout.DEFAULT_SIZE,
																								404,
																								Short.MAX_VALUE)
																						.addComponent(
																								panel_1,
																								GroupLayout.DEFAULT_SIZE,
																								404,
																								Short.MAX_VALUE))
																		.addContainerGap()))));
		gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_contentPane
						.createSequentialGroup()
						.addContainerGap()
						.addComponent(panel, GroupLayout.PREFERRED_SIZE, 87,
								GroupLayout.PREFERRED_SIZE)
						.addGap(18)
						.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 86,
								GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(ComponentPlacement.RELATED, 16,
								Short.MAX_VALUE).addComponent(btnNewButton_2)
						.addContainerGap()));

		JButton FireplaceButton = new JButton("Fireplace");
		FireplaceButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			
				new Report(fireplaceQuery, fireplaceTitle);
				thisFrame.dispose();

			}
		});
		FireplaceButton.setFont(new Font("Arial Black", Font.PLAIN, 14));
		FireplaceButton.setToolTipText("");

		JButton SupplierButton = new JButton("Supplier");
		SupplierButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {

				new Report(supplierQuery, supplierTitle);
				thisFrame.dispose();
			}
		});
		SupplierButton.setFont(new Font("Arial Black", Font.PLAIN, 14));
		GroupLayout gl_panel_1 = new GroupLayout(panel_1);
		gl_panel_1.setHorizontalGroup(gl_panel_1.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_panel_1
						.createSequentialGroup()
						.addContainerGap()
						.addComponent(FireplaceButton,
								GroupLayout.PREFERRED_SIZE, 146,
								GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(ComponentPlacement.RELATED, 88,
								Short.MAX_VALUE)
						.addComponent(SupplierButton,
								GroupLayout.PREFERRED_SIZE, 146,
								GroupLayout.PREFERRED_SIZE).addContainerGap()));
		gl_panel_1
				.setVerticalGroup(gl_panel_1
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								Alignment.TRAILING,
								gl_panel_1
										.createSequentialGroup()
										.addGap(22)
										.addGroup(
												gl_panel_1
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																FireplaceButton,
																GroupLayout.DEFAULT_SIZE,
																40,
																Short.MAX_VALUE)
														.addComponent(
																SupplierButton,
																GroupLayout.DEFAULT_SIZE,
																40,
																Short.MAX_VALUE))
										.addGap(20)));
		panel_1.setLayout(gl_panel_1);

		JLabel lblNewLabel = new JLabel("Select Report Type");
		lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 22));
		GroupLayout gl_panel = new GroupLayout(panel);
		gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(
				Alignment.LEADING).addGroup(
				Alignment.TRAILING,
				gl_panel.createSequentialGroup()
						.addContainerGap(97, Short.MAX_VALUE)
						.addComponent(lblNewLabel).addGap(81)));
		gl_panel.setVerticalGroup(gl_panel.createParallelGroup(
				Alignment.LEADING).addGroup(
				Alignment.TRAILING,
				gl_panel.createSequentialGroup()
						.addContainerGap()
						.addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE,
								61, Short.MAX_VALUE).addContainerGap()));
		panel.setLayout(gl_panel);
		contentPane.setLayout(gl_contentPane);
	}

}
